package com.lingchou.cloud.process.api.controller;

import com.lingchou.cloud.process.api.dto.result.ProcessInstanceDTO;
import com.lc.common.bean.response.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;


/**
 * 流程创建API
 *
 * @author lc
 */
@RequestMapping(value = "process/v1")
@Api(value = "ProcessStartApi", tags = "流程创建API")
public interface ProcessStartApi {
    /**
     * 创建新流程实例
     *
     * @param definitionId 流程定义ID
     * @param userId       发起人ID
     * @param typeId       类型ID
     * @return 流程实例ID
     */
    @ApiOperation(value = "创建流程实例", notes = "根据发布ID启动一个实例，指定发起人，返回实例ID")
    @GetMapping("/startByDefinitionId")
    Result<ProcessInstanceDTO> startInstanceByDefinitionId(@ApiParam(name = "definitionId", value = "流程定义ID") @RequestParam String definitionId,
                                                           @ApiParam(name = "userId", value = "发起人ID") @RequestParam String userId,
                                                           @ApiParam(name = "typeId", value = "发起类型ID") @RequestParam String typeId,
                                                           @ApiParam(name = "params", value = "启动参数") @RequestParam(required = false) Map<String, Object> params);

    @GetMapping("/getUserId")
    Result<String> getUserId();
}
